<template>
  <div>
    <p>用户名：{{ userStore.name }}</p>
    <p>是否登录：{{ userStore.isLogin ? '是' : '否' }}</p>
    <button @click="handleLogin">Pinia 登录</button>
    <button @click="userStore.logout">退出登录</button>
  </div>
</template>

<script setup>
import { useUserStore } from '@/store/user';
const userStore = useUserStore();

const handleLogin = async () => {
  const res = await userStore.login({ name: '李四' });
  console.log(res);
};
</script>